/*
 *	OpenSource code and fragments by avocado systems, Marcus Fuhrmeister
 *
 *	Redistribution and use in source and binary forms, with or without
 *	modification, are permitted provided that the following conditions
 *	are met:
 *  
 *		* Redistribution of source code must retain the above OpenSource comment,
 *		this list of conditions and the following disclaimer.
 * 
 *		* Redistribution in binary form must reproduce the above OpenSource comment,
 *		this list of conditions and the following disclaimer in the
 *		documentation and/or other materials provided with the distribution.
 * 
 *	Neither the name of 'avocaod systems, Marcus Fuhrmeister' or the
 *	names of contributors may be used to endorse or promote products derived
 *	from this software without specific prior written permission.
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the Free Software
 *	Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
 */
package de.fuhrmeister.util;

/**
 * Helper class to determine the OS.
 * 
 * @date 20.10.2009
 * @author Marcus Fuhrmeister
 */
public class OSValidator {

	public final static String OSNAME = System.getProperty("os.name").toLowerCase();

	/**
	 * Returns <code>true</code> if the system property "os.name" contains a
	 * Windows releated string.
	 * 
	 * @return true if the OS is Windows
	 */
	public static boolean isWindows() {
		return OSValidator.OSNAME.indexOf("win") >= 0;
	}

	/**
	 * Returns <code>true</code> if the system property "os.name" contains a
	 * Macintosh releated string.
	 * 
	 * @return true if the OS is Macintosh
	 */
	public static boolean isMac() {
		return OSValidator.OSNAME.indexOf("mac") >= 0;
	}

	/**
	 * Returns <code>true</code> if the system property "os.name" contains a
	 * Unix releated string.
	 * 
	 * @return true if the OS is Unix
	 */
	public static boolean isUnix() {
		return OSValidator.OSNAME.indexOf("nix") >= 0 || OSValidator.OSNAME.indexOf("nux") >= 0;
	}
	
	/**
	 * Returns <code>true</code> if the system architecture is based on Intel.
	 * 
	 * @return true if the architecture is based on Intel
	 */
	public static boolean isIntel() {
		return (System.getProperty("os.arch").indexOf("x86") >= 0 ) ? true : false;
	}
}

/*
 * System.getProperty();
 * 
java.version 	                Java Runtime Environment version
java.vendor 	                Java Runtime Environment vendor
java.vendor.url 	        	Java vendor URL
java.home 	                	Java installation directory
java.vm.specification.version 	Java Virtual Machine specification version
java.vm.specification.vendor 	Java Virtual Machine specification vendor
java.vm.specification.name 		Java Virtual Machine specification name
java.vm.version 	        	Java Virtual Machine implementation version
java.vm.vendor 	                Java Virtual Machine implementation vendor
java.vm.name 	                Java Virtual Machine implementation name
java.specification.version 		Java Runtime Environment specification version
java.specification.vendor 		Java Runtime Environment specification vendor
java.specification.name 		Java Runtime Environment specification name
java.class.version 	        	Java class format version number
java.class.path 	        	Java class path
java.library.path 	        	List of paths to search when loading libraries
java.io.tmpdir 	                Default temp file path
java.compiler 	                Name of JIT compiler to use
java.ext.dirs 	                Path of extension directory or directories
os.name 	                	Operating system name
os.arch 	                	Operating system architecture
os.version 	                	Operating system version
file.separator 	                File separator ("/" on UNIX)
path.separator 	                Path separator (":" on UNIX)
line.separator 	                Line separator ("\n" on UNIX)
user.name 	                	User's account name
user.home 	               	 	User's home directory
user.dir 	                	User's current working directory
 */
 
